package zw_301_400.zw_389_找不同;

class Solution {

    public static void main(String[] args) {
        String s = "abcd", t = "abcde";
        char difference = findTheDifference(s, t);
        System.out.println(difference);
    }

    public static char findTheDifference(String s, String t) {
        int[] record = new int[26];
        for (int i = 0; i < s.length(); i++) {
            record[s.charAt(i) - 'a']++;
        }
        for (int i = 0; i < t.length(); i++) {
            record[t.charAt(i) - 'a']--;
            if (record[t.charAt(i) - 'a'] < 0) {
                return t.charAt(i);
            }
        }
        return ' ';
    }
}
